{extend name="base/layer_layout" /}

{block name="body"}
<article class="cl pd-20">
    <form action="{:url('admin/AuthManager/addGroupAccess')}" method="post" class="form form-horizontal" id="form-admin-role-add">
    <div class="text-c"> 添加管理员：
        <input type="hidden" name="groupid" value="{$groupId}">
        <input type="text" class="input-text" style="width:250px" placeholder="请输入后台管理者编号，多个用逗号隔开" id="adminids" name="adminids">
        <button type="button" class="btn btn-success" id="add-group-access" name=""><i class="Hui-iconfont"></i> 添加用户</button>
    </div>
    </form>

    <div class="cl pd-5 bg-1 bk-gray mt-5">
        <span class="l">
            <!--<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>-->
        </span>
        <!--<span class="r">共有数据：<strong>54</strong> 条</span>-->
    </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="11">管理组列表</th>
        </tr>
        <tr class="text-c">
            <th width="25">
                <input type="checkbox" name="" value="">
            </th>
            <th>用户编号</th>
            <th>组名</th>
            <th>昵称</th>
            <th>登陆邮箱</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            <td><input type="checkbox" value="1" name="{$vo.admin_id}"></td>
            <td>{$vo.admin_id}</td>
            <td>{$vo.group_name}</td>
            <td>{$vo.nickname}</td>
            <td>{$vo.email}</td>
            <td class="td-manage">
                <a title="删除" href="javascript:;" onclick="admin_del(this,'{$vo.admin_id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
</article>
{/block}


{block name="script"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__EXP_PLUGIN__/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__EXP_PLUGIN__/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__EXP_PLUGIN__/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    /*
     参数解释：
     title	标题
     url		请求的url
     id		需要操作的数据id
     w		弹出层宽度（缺省调默认值）
     h		弹出层高度（缺省调默认值）
     */

    /*管理员-删除*/
    function admin_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.post("{:url('admin/AuthManager/delGroupAccess')}", {groupid: "{$groupId}", adminids: id}, function (result) {
                layer.msg(result.msg);
                if (result.code) {
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                }
            }, 'json');
        });
    }
    $(function(){
        $("#add-group-access").click(function () {
            $.ajax({
                type: 'POST',
                url: $("#form-admin-role-add").attr('action'),
                dataType: 'json',
                data: $("#form-admin-role-add").serialize(),
                success: function(result){
                    layer.msg(result.msg);

                    setTimeout(function () {
                        window.location.href = result.url;
                    }, 1500);
                },
                error:function(result) {
                    layer.msg(result.msg);
                }
            });
        });
    });

</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}